% References in [Conan,1995]
% m ~= 0
function W_aj_wind = W_aj_theta(W_aj, theta, n_max)
% W_aj: PSD of Coefficients for Znk polynomials
% theta: [rad], Wind angle 'theta' with respect to the x axis
% n_max: maximum radial frequency n for Znk plynomials
% OUTPUT: W_aj_theta: the PSD for any given wind direction with  'theta'
W_aj_wind = W_aj;
for n = 1:n_max
    for m = 0:n
        if (m~=0) && (mod(n-m, 2)==0)   
            % m=0时，znk多项式圆对称; n-m = even时，有cos和sin项
            j1 = Noll_nm_to_j(n,m);
            j2 = j1+1;
            j1_idx  = j1-1; j2_idx = j2-1; % Piston term has been extracted
            W_aj_wind(:,:,j1_idx) = W_j12(theta, W_aj(:,:,j1_idx), W_aj(:,:,j2_idx));
            W_aj_wind(:,:,j2_idx) = W_j12(theta, W_aj(:,:,j2_idx), W_aj(:,:,j1_idx));
        end
    end
end
    
    % sub-function for generating W_Gi_theta
    function W_v = W_j12(theta, W_v1, W_v2)
        W_v = (cos(theta))^2 * W_v1 + (sin(theta))^2 * W_v2;
    end

% end of the function
end